/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef NODE_DB_RDB_DETAILS_MYSQL_DATABASE_H_
#define NODE_DB_RDB_DETAILS_MYSQL_DATABASE_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include "node/db/rdb/database.h"

namespace node {
    namespace rdb {

        class MySQLDatabase : public ::node::rdb::Database
        {
        public:
            MySQLDatabase(void);
            virtual ~MySQLDatabase(void);

        public:
            virtual bool Initialize(const ::std::string &host,
                const ::std::string &port, const ::std::string &user,
                const ::std::string &pass, const ::std::string &db, bool auto_reconnect = true);
            virtual bool Initialize(const ::std::string &info, bool auto_reconnect = true);
            virtual void Close(void);

            virtual void EscapeString(::std::string &sql);
            virtual void Ping(void);

        protected:
            virtual bool Reconnect(void);
        };

    }
}

#endif // NODE_DB_RDB_DETAILS_MYSQL_DATABASE_H_
